<template>
  <div style="line-height: 34px !important;">
    <el-button v-if="isAuth('examTest:list:view') && params.data.passwordType === '1'" type="primary" title="通过密码查看" circle size="small" @click.stop="passwordByView">
      <span class="icon iconfont icon-shichangxinxitianbaoguanli-04"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:view') && params.data.passwordType !== '1'" type="primary" title="普通查看" circle size="small" @click.stop="viewHandle">
      <span class="icon iconfont icon-chakan5"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:edit') && params.data.passwordType === '1'" :disabled="params.data.examStatus === '1' || params.data.ifUse === '1'" type="primary" title="通过密码编辑" circle size="small" @click.stop="passwordByEdit">
      <span class="icon iconfont icon-mimabianji"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:edit') && params.data.passwordType !== '1'" :disabled="params.data.examStatus === '1' || params.data.ifUse === '1'" type="primary" title="编辑" circle size="small" @click.stop="editHandle">
      <span class="el-icon-edit"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:delete') && params.data.passwordType === '1'" :disabled="params.data.examStatus === '1'" type="danger" title="通过密码删除" circle size="small" @click.stop="delByPwdHandle">
      <span class="icon iconfont icon-shanchuquanxian"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:delete') && params.data.passwordType !== '1'" :disabled="params.data.examStatus === '1'" type="danger" title="删除" circle size="small" @click.stop="delHandle">
      <span class="icon iconfont icon-shanchu"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:export') && params.data.passwordType === '1' && params.data.type ==='B类' && params.data.ifSaoma !== '1'" type="success" title="通过密码导出考生二维码" circle size="small" @click.stop="getZipByPwdHandle">
      <span class="icon iconfont icon-erweima"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:export') && params.data.passwordType !== '1' && params.data.type ==='B类' && params.data.ifSaoma !== '1'" type="success" title="导出考生二维码" circle size="small" @click.stop="getZipHandle">
      <span class="icon iconfont icon-erweima"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:resetPwd') && params.data.passwordType === '1'" type="warning" title="重置密码" circle size="small" @click.stop="resetItem">
      <span class="icon iconfont icon-zhongzhimima"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:exportExcel') && params.data.passwordType === '1' && params.data.type ==='A类'" type="primary" title="通过密码导出考生轮次列表" circle size="small" @click.stop="getExcelByPwdHandle">
      <span class="icon iconfont icon-excel1"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:exportExcel') && params.data.passwordType !== '1'" type="primary" title="导出考生轮次列表" circle size="small" @click.stop="getExcelHandle">
      <span class="icon iconfont icon-mimawenjianxiaoyanhe"></span>
    </el-button>
    <!-- 路岩补充：B类和A类 匿名的必须要抽号（ifAnonymous： 1）📅 -->
    <el-button v-if="isAuth('examTest:list:exportExcel') && (params.data.type === 'B类' && params.data.ifAnonymous === '1')" type="primary" title="导出考试二维码" circle size="small" @click.stop="getQRHandle">
      <!-- 匿名（ifAnonymous：1）或者快速考试（ifSaoma -->
      <span class="icon iconfont icon-erweima"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:exportExcel') && ( params.data.type === 'A类')" type="primary" title="导出考试二维码" circle size="small" @click.stop="getQRHandleA">
      <span class="icon iconfont icon-erweima"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:exportExcel') && params.data.passwordType !== '1'" type="warning" title="查看考试详情" circle size="small" @click.stop="getExamDetail">
      <span class="icon iconfont icon-view_conference_testdetails"></span>
    </el-button>
    <el-button v-if="isAuth('examTest:list:exportExcel') && params.data.passwordType === '1'" type="warning" title="密码查看考试详情" circle size="small" @click.stop="getExamDetailByPwd">
      <span class="icon iconfont icon-PBOMbanbenxinxi"></span>
    </el-button>
    <!-- <el-button type="warning" title="重置数据" circle size="small" @click.stop="resetDataHandle">
      <span class="icon iconfont icon-shujugengxin"></span>
    </el-button> -->
  </div>
</template>
<script>
import Vue from 'vue'
export default Vue.extend({
  // props: ["flag"],
  data () {
    return {}
  },
  methods: {
    viewHandle () {
      this.params.context.componentParent.viewHandle(this.params.data, false)
    },
    passwordByView () {
      this.params.context.componentParent.passwordByView(this.params.data)
    },
    editHandle () {
      this.params.context.componentParent.editHandle(this.params.data, false)
    },
    passwordByEdit () {
      this.params.context.componentParent.passwordByEdit(this.params.data)
    },
    delHandle () {
      this.params.context.componentParent.delHandle(this.params.data)
    },
    delByPwdHandle () {
      this.params.context.componentParent.delByPwdHandle(this.params.data)
    },
    getZipHandle () {
      this.params.context.componentParent.getZipHandle(this.params.data)
    },
    getZipByPwdHandle () {
      this.params.context.componentParent.getZipByPwdHandle(this.params.data)
    },
    getExcelHandle () {
      this.params.context.componentParent.getExcelHandle(this.params.data)
    },
    getExcelByPwdHandle () {
      this.params.context.componentParent.getExcelByPwdHandle(this.params.data)
    },
    resetItem () {
      this.params.context.componentParent.resetItem(this.params.data)
    },
    getQRHandle () {
      this.params.context.componentParent.getQRHandle(this.params.data)
    },
    getQRHandleA () {
      this.params.context.componentParent.getQRHandleA(this.params.data)
    },
    getExamDetail () {
      this.params.context.componentParent.getExamDetail(this.params.data)
    },
    getExamDetailByPwd () {
      this.params.context.componentParent.getExamDetailByPwd(this.params.data)
    }
    // resetDataHandle () {
    //   this.params.context.componentParent.resetDataHandle(this.params.data)
    // }
  }
})
</script>
